﻿/**
 * User: GCZX005-WJJ
 * Date: 2015-05-25
 * 版本：v1.0.0
 */
window.onerror = function(){return true;};
//扩展获取URL参数的方法
(function ($) {
    $.getUrlParam = function (name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURI(r[2]); return null;
    };
})(jQuery);
var myQx = "";
$(function () {
//    var urlinfo = window.location.href; //获取当前页面的url
//    var len = urlinfo.length; //获取url的长度
//    var offset = urlinfo.indexOf("?"); //设置参数字符串开始的位置
//    var newsidinfo = urlinfo.substr(offset, len) //取出参数字符串 这里会获得类似“id=1”这样的字符串

//    var newsids1 = newsidinfo.split("&"); //对获得的参数字符串按照“=”进行分割
//    var newsids11 = newsids1[0];
//    var newsids12 = newsids1[1];

//    var newsids = newsids11.split("="); //对获得的参数字符串按照“=”进行分割

//    var xzq = (newsids[1]); //得到参数值
//    var xzqname = newsids[0]; //得到参数名字

//    var newsids121 = newsids12.split("="); //对获得的参数字符串按照“=”进行分割
//    var qxname = (newsids121[1]); //得到参数值
//    var qx = newsids121[0]; //得到参数名字
//    if (qx == "qx") myQx = qxname;

    var urlinfo = window.location.href; //获取当前页面的url
    var len = urlinfo.length; //获取url的长度
    var offset = urlinfo.indexOf("?"); //设置参数字符串开始的位置
    var newsidinfo = urlinfo.substr(offset, len)//取出参数字符串 这里会获得类似“id=1”这样的字符串
    var newsids = newsidinfo.split("="); //对获得的参数字符串按照“=”进行分割
    var xzq = (newsids[1]); //得到参数值
    var xzqname = newsids[0]; //得到参数名字


    SQuery.init(); //初始化服务查询页面
    //排序选择
    $("#servicesort").bind('change', function () {
        var div = $("#mian_right");
        div.empty();
        SQuery.QTableServiceList(div);
    });
    //倒序和顺序选择
    var d = $("#servicesortlabel");
    d.empty();
    var txt = "";
    txt += '<i class="fa fa-sort-alpha-desc" ></i><i class="fa fa-sort-numeric-desc"></i>';
    d.html(txt);
    $("#servicesortlabel").bind('click', function () {
        var value = $(this).attr('data-name');
        if (value == "desc") {
            var d = $("#servicesortlabel");
            d.empty();
            var txt = "";
            txt += '<i class="fa fa-sort-alpha-asc"></i><i class="fa fa-sort-numeric-asc"></i>';
            d.html(txt);
            $(this).attr('data-name', "asc");
            var div = $("#mian_right");
            div.empty();
            SQuery.QTableServiceList(div);
        } else {
            var d = $("#servicesortlabel");
            d.empty();
            var txt = "";
            txt += '<i class="fa fa-sort-alpha-desc" ></i><i class="fa fa-sort-numeric-desc"></i>';
            d.html(txt);
            $(this).attr('data-name', "desc");
            var div = $("#mian_right");
            div.empty();
            SQuery.QTableServiceList(div);
        }
    });

    //判断用户权限
    setTimeout(function () {
        SQuery.IsUserByEmail(); //初始化服务查询页面
    }, 1000);
    //服务搜索
    $("#autocompleteq").autocomplete({
        source: function (request, response) {
            $.ajax({
                type: "POST",
                url: data.qurl,
                dataType: "json",
                data: {
                    stype: "serviceNameSearch",
                    keyword: request.term,
                    state: "1"
                },
                success: function (data) {
                    if ((data.data).length > 0) {
                        response($.map(data.data, function (item) {
                            return {
                                label: item.title,
                                value: item.title
                            };
                        }));
                    }
                    //else{
                    //    var arr=[{title: "不好意思，找不到符合搜索条件的服务内容。", result: "不好意思，找不到符合搜索条件的服务内容。"}];
                    //    response($.map(arr, function(item) {
                    //        return {
                    //            label: item.title,
                    //            value: item.title
                    //        }
                    //    }));
                    //}
                }
            });
        },
        minLength: 1
    });
    //服务查询检索-点击事件
    $("#autocompletebtnq").bind('click', function () {
        var value = $("#autocompleteq").val(); //查询条件
        if (value != $("#autocompleteq").attr('placeholder')) {
            query(value); //服务查询
        }

    });

    //服务搜索键盘事件
    $("#autocompleteq").keypress(function (e) {
        if (e.keyCode == 13) {
            $("#autocompletebtnq").click();
            $("#autocompleteq").autocomplete("close");
        }
    });

    //返回查询全部结果
    $("#fwzyq").click(function () {
        $("#autocompleteq").val('');
        if ($("#search-filter").children().length == 1) {
            $("#search-filter").css({ display: "none" });
        } else {
            $("#search-filter").children('span').remove();
            $("#search-filter").css({ display: "none" });
        }
        query('');
    });
});
//发起查询请求、查询结果绑定显示
function query(value) {
    $.ajax({
        type: "POST",
        url: data.qurl,
        data: {
            stype: "GetServerListByPage2",
            keywords: "",
            state: "1",
            pageNum: "1",
            pageSize: "10",
            keyname: $("#servicesort").children('option:checked').attr('data-name'),
            sort: "desc",
            searchText: value
        },
        success: function (result) {
            var div = $("#mian_right"); 
            div.empty();
            bindFuwuInfoList(result, div,1);
        },
        error: function (e) {
            alert("获取列表失败！04");
        }
    });
        //绑定显示左侧专题栏
        $.ajax({
            type: "POST",
            async: false,
            data: {
                    "stype": "getTypeList2",
                "state": "1",
                "searchText": value
            },
            url: qurl,
            //dataType: "json",
            success: function (json) {
                var div = $("#mian_left");
                div.empty();
                var txt = json;
                SQuery.QTableList(div, txt);
            },
            error: function (e) {
                alert("获取列表失败！01");
            }
        });
}


//分页页码公有变量
var page=0;//页面总数 39/5=8页
var page_num=0;//分页面板个数
var page_now=1;//当前面板编号
var num_big=0;//当前页面最大页码
var num_little=0;//当前页面最小页码
var keywords="";
//分页对象
var SQuery = {
    init: function () {
        if ($.getUrlParam('value')) {
            //query($.getUrlParam('value'));
            $("#autocompleteq").focus();
            $("#autocompleteq").val($.getUrlParam('value'));
        }
        //初始化加载主题分类
        var div = $("#mian_left");
        div.empty();
        SQuery.Get_QTableList(div);
        //初始化服务列表
        var div = $("#mian_right");
        div.empty();
        SQuery.QTableServiceList(div);

    },
    //初始化加载主题分类
    QTableList: function (div, json) {
        var txt = "";
        if (json) {
            var jsonList = json.split('||');
            var jsonServiceType = $.parseJSON(jsonList[0]);
            var jsonSub = $.parseJSON(jsonList[1]);
            for (var i = 0; i < jsonServiceType.length; i++) {
                //主题（分类）树 
                txt += '<div class="list-group categorys">';
                txt += '<span class="list-group-item text-center themeZY F14" id="id1">';
                txt += '<a href="javascript:void(0);" id="25bde262-31b4-4901-8d53-527631005f6a">' + jsonServiceType[i].S_FL + '</a>';
                txt += '<i class="collapse-category"></i>';
                txt += '</span>';
                txt += '<div class="resource-statistics">';
                if (i < 7) {
                    var count = 0;
                    for (var j = 0; j < jsonSub.length; j++) {
                        if (jsonSub[j].TYPE == jsonServiceType[i].S_FL) {
                            if (jsonSub.COUNT != "0") {
                                count = count + 1;
                                var name = jsonSub[j].S_MC;
                                var namev = jsonSub[j].S_MC + "(" + jsonSub[j].COUNT + ")";
                                if (count > 5) {
                                    txt += '<a href="javascript:void(0);" class="list-group-item text-center"  data-name="' + name + '"  name="' + name + '" data-class="' + _serviceTypeList[jsonServiceType[i].S_FL] + '" title="' + name + '" style="display:none">' + namev + '</a>';
                                } else {
                                    txt += '<a href="javascript:void(0);" class="list-group-item text-center"  data-name="' + name + '"  name="' + name + '" data-class="' + _serviceTypeList[jsonServiceType[i].S_FL] + '" title="' + name + '">' + namev + '</a>';
                                }
                            }
                        }
                        if (count > 5) {//(json[i].lscm).length>5
                            txt += '<a href="javascript:void(0);" class="list-group-item text-center showmore"  data-name="1">显示更多<i class="fa fa-chevron-down" style="float: right;color: #ccc;"></i></a>';
                        }
                    }
                }
                //                else {
                //                    if (json[i] != null) {
                //                        var count = 0;
                //                        for (var j = 0; j < (json[i].units).length; j++) {
                //                            if ((json[i].units)[j][1] != "0") {
                //                                count++;
                //                                var name = (json[i].units)[j].unit;
                //                                var br = 9;
                //                                var names = name.substr(0, br);
                //                                if (name.length > 9) {
                //                                    names = names + "...";
                //                                }
                //                                var namev = names + "(" + (json[i].units)[j].count + ")";
                //                                if (j > 4) {
                //                                    txt += '<a href="javascript:void(0);" class="list-group-item text-center"  data-name="' + name + '"  name="' + name + '" data-class="' + json[i].nameen + '" title="' + name + '" style="display:none">' + namev + '</a>';
                //                                } else {
                //                                    txt += '<a href="javascript:void(0);" class="list-group-item text-center"  data-name="' + name + '"  name="' + name + '" data-class="' + json[i].nameen + '"  title="' + name + '">' + namev + '</a>';
                //                                }
                //                            }
                //                        }
                //                        if (count > 5) {//(json[i].units).length
                //                            txt += '<a href="javascript:void(0);" class="list-group-item text-center showmore"  data-name="1">显示更多<i class="fa fa-chevron-down" style="float: right;color: #ccc;"></i></a>';
                //                        }
                //                    }
                //                }
                txt += '</div>';
                txt += '</div>';
            }
        }
        div.html(txt);
        //主题树列表点击事件
        $(".resource-statistics").find('a').bind('click', function () {
            if ($(this).text() == "显示更多" || $(this).text() == "收起") {
                if ($(this).attr('data-name') == "1") {
                    $(this).attr('data-name', "2");
                    $(this).parent().children().css({ display: "block" });
                    $(this).empty();
                    $(this).append('收起<i class="fa fa-chevron-up" style="float: right;color: #ccc;"></i>');
                } else {
                    $(this).attr('data-name', "1");
                    var l = $(this).parent().children().length;
                    for (var i = 5; i < (l - 1); i++) {
                        $(this).parent().children().eq(i).css({ display: "none" });
                    }
                    $(this).empty();
                    $(this).append('显示更多<i class="fa fa-chevron-down" style="float: right;color: #ccc;"></i>');
                }

            } else {
                if ($(this).children().length > 0) {
                    $(this).children().remove();
                    var name = $(this).attr('data-name');
                    $("span[name='" + name + "']").remove();
                    //删除标签获取服务列表
                    if ($("#search-filter").children().length == 1) {
                        $("#search-filter").css({ display: "none" });
                    }
                    //删除标签获取服务列表
                    SQuery.Get_QTableServiceList_ByP();
                } else {
                    var name = $(this).attr('data-name');
                    var nameen = $(this).attr('data-class');
                    if ($("#search-filter:visible").length == 0) {
                        $("#search-filter").css({ display: "block" });
                    }
                    $(this).append('<a href="#" class="remove"  onclick="SQuery.RemoveList(this)" style="float: right;font-size: 20px;color: #337ab7;"><i class="fa fa-times-circle"></i></a>');
                    $("#search-filter").append('<span class="filtered pill" data-name="' + name + '" data-class="' + nameen + '" name="' + name + '">' + name + '<a href="#" class="remove" title="删除"  onclick="SQuery.Remove(this)"><i class="fa fa-times" ></i></a></span>');
                    SQuery.Get_QTableServiceList_ByP();
                }
            }
        });
    },
    //绑定左侧主题信息
    Get_QTableList: function (div) {
        var txt = "";
        var value = $("#autocompleteq").val();
        if (value == $("#autocompleteq").attr('placeholder'))
            value = '';
        if (userno == "县级用户")
            value = "会文镇";
        var para = {
            "stype": "getTypeList2",
            "state": 1,
            "searchText": value
        };
        $.ajax({
            type: "POST",
            async: false,
            data: para,
            url: qurl,
            success: function (json) {
                //txt = $.parseJSON(json);
                SQuery.QTableList(div, json);
            },
            error: function (e) {
                alert("获取列表失败！02");
            }
        });
    },
    //初始化加载服务列表
    QTableServiceList: function (div) {
        SQuery.Get_QTableServiceList(div, 1); //加载第一页
    },
    //右侧服务列表绑定显示
    Get_QTableServiceList: function (div, pageNum) {
        var value = $("#autocompleteq").val();
        if (value == $("#autocompleteq").attr('placeholder'))
            value = '';
        if (userno == "县级用户")
            value = "会文镇";
        var para = {
            "stype": "GetServerListByPage2",
            "keywords": keywords,
            "pageNum": pageNum,
            "pageSize": 10,
            "keyname": $("#servicesort").children('option:checked').attr('data-name'),
            "sort": $("#servicesortlabel").attr('data-name'),
            "searchText": value,
            "state": 1
        };


        $.ajax({
            type: "POST",
            async: false,
            data: para,
            url: qurl,
            success: function (json) {
                //

                bindFuwuInfoList(json, div, pageNum);
            },
            error: function (e) {
                alert("获取列表失败！03");
            }
        });

    },
    //删除标签获取服务列表
    Get_QTableServiceList_ByP: function () {
        var length = $("#search-filter").find('span').length;
        var txt = "";
        for (var i = 0; i < length; i++) {
            var type = $("#search-filter").find('span').eq(i).attr('data-class');
            var value = $("#search-filter").find('span').eq(i).attr('data-name');
            txt += type + "," + value + ";";
        }
        var div = $("#mian_right");
        div.empty();
        keywords = txt;
        SQuery.QTableServiceList(div);
    },
    //添加分页工具
    Add_pagination: function (totalRecords) {
        if (totalRecords > 0) {
            page = Math.ceil(parseInt(totalRecords) / 10); //页面总数 39/5=8页
            page_num = Math.ceil(parseInt(page) / 5); //分页面板个数
            page_now = 1; //当前面板编号
            num_big = 0; //当前页面最大页码
            num_little = 0; //当前页面最小页码
            var div = $("#pagination");
            div.empty();
            var txt = "";
            if (parseInt(page_num) == 1) {
                txt += '<ul class="pagination">';
                txt += '<li class="disabled"><a href="#">&laquo;</a></li>';
                for (var i = 0; i < parseInt(page); i++) {
                    if (i < 5) {
                        txt += '<li name="page_num"><a href="#">' + (i + 1) + '</a></li>';
                        num_big = parseInt(num_big) + 1;
                    }
                }
                txt += '<li class="disabled"><a href="#">&raquo;</a></li>';
                txt += '</ul>';
            } else {
                txt += '<ul class="pagination">';
                txt += '<li class="disabled"><a href="#">&laquo;</a></li>';
                for (var i = 0; i < parseInt(page); i++) {
                    if (i < 5) {
                        txt += '<li name="page_num"><a href="#">' + (i + 1) + '</a></li>';
                        num_big = parseInt(num_big) + 1;
                    }
                }
                txt += '<li name="page_next"><a href="#">&raquo;</a></li>';
                txt += '</ul>';
            }
            div.html(txt);
            $("li[name='page_num']").eq(0).addClass('active'); //选中当前页面最小页码
            num_big = parseInt(num_big); //当前页面最大页码
            num_little = parseInt($("li[name='page_num']").eq(0).children().text()); //当前页面最小页码
            //页码切换（点击li）
            SQuery.PageNum_Change();
            //页码切换（点击上一页）
            SQuery.PageNum_Change_Back();
            //页码切换（点击下一页）
            SQuery.PageNum_Change_Next();
        }
    },
    //页码切换（点击li）
    PageNum_Change: function () {
        $("li[name='page_num']").bind('click', function () {
            $(".pagination").children().removeClass('active');
            $(this).addClass('active');
            var pageNum = $(this).children().text();
            var div = $("#mian_right");
            div.empty();
            SQuery.Get_QTableServiceList(div, pageNum);
        });
    },
    //页码切换（点击上一页）
    PageNum_Change_Back: function () {
        //页码切换（点击上一页）
        $("li[name='page_back']").bind('click', function () {
            var div = $("#pagination");
            div.empty();
            var txt = "";
            page_now = parseInt(page_now) - 1;
            num_little = parseInt(num_little) - 5;
            //alert(num_little+";"+page_now);
            if (page_now == 1) {
                txt += '<ul class="pagination">';
                txt += '<li class="disabled"><a href="#">&laquo;</a></li>';
                for (var i = parseInt(num_little); i < parseInt(page); i++) {
                    if (i < (parseInt(num_little) + 5)) {
                        txt += '<li name="page_num"><a href="#">' + (i + 1) + '</a></li>';
                        num_big = parseInt(num_big) + 1;
                    }
                }
                if (page_now == parseInt(page_num)) {
                    txt += '<li class="disabled"><a href="#">&raquo;</a></li>';
                } else {
                    txt += '<li name="page_next"><a href="#">&raquo;</a></li>';
                }
                txt += '</ul>';
            } else {
                txt += '<ul class="pagination">';
                txt += '<li name="page_back"><a href="#">&laquo;</a></li>';
                for (var i = parseInt(num_little); i < parseInt(page); i++) {
                    if (i < (parseInt(num_little) + 5)) {
                        txt += '<li name="page_num"><a href="#">' + (i + 1) + '</a></li>';
                        num_big = parseInt(num_big) + 1;
                    }
                }
                txt += '<li name="page_next"><a href="#">&raquo;</a></li>';
                txt += '</ul>';
            }
            div.html(txt);
            //页码切换（点击li）
            SQuery.PageNum_Change();
            $("li[name='page_num']").eq(0).click();
            //num_big=parseInt($("li[name='page_num']").eq(4).children().text());//当前页面最大页码
            //num_little=parseInt($("li[name='page_num']").eq(0).children().text());//当前页面最小页码
            //页码切换（点击上一页）
            SQuery.PageNum_Change_Back();
            // 页码切换（点击下一页）
            SQuery.PageNum_Change_Next();
        });
    },
    //页码切换（点击下一页）
    PageNum_Change_Next: function () {
        //页码切换（点击下一页）
        $("li[name='page_next']").bind('click', function () {
            var div = $("#pagination");
            div.empty();
            var txt = "";
            page_now = parseInt(page_now) + 1;
            num_little = parseInt(num_big);
            if (page_now == parseInt(page_num)) {
                txt += '<ul class="pagination">';
                txt += '<li name="page_back"><a href="#" >&laquo;</a></li>';
                for (var i = parseInt(num_little); i < parseInt(page); i++) {
                    if (i < (parseInt(num_little) + 5)) {
                        txt += '<li name="page_num"><a href="#">' + (i + 1) + '</a></li>';
                        num_big = parseInt(num_big) + 1;
                    }
                }
                txt += '<li class="disabled"><a href="#">&raquo;</a></li>';
                txt += '</ul>';
            } else {
                txt += '<ul class="pagination">';
                txt += '<li  name="page_back"><a href="#">&laquo;</a></li>';
                for (var i = parseInt(num_little); i < parseInt(page); i++) {
                    if (i < (parseInt(num_little) + 5)) {
                        txt += '<li name="page_num"><a href="#">' + (i + 1) + '</a></li>';
                        num_big = parseInt(num_big) + 1;
                    }
                }
                txt += '<li name="page_next"><a href="#" >&raquo;</a></li>';
                txt += '</ul>';
            }
            div.html(txt);

            //页码切换（点击li）
            SQuery.PageNum_Change();
            $("li[name='page_num']").eq(0).click();
            //num_big=parseInt($("li[name='page_num']").eq(4).children().text());//当前页面最大页码
            //num_little=parseInt($("li[name='page_num']").eq(0).children().text());//当前页面最小页码
            //页码切换（点击上一页）
            SQuery.PageNum_Change_Back();
            // 页码切换（点击下一页）
            SQuery.PageNum_Change_Next();
        });

    },
    //删除已选择标签
    Remove: function (e) {
        $(e).parent().remove();
        var name = $(e).parent().attr('data-name');
        $("a[name='" + name + "']").children().remove();
        if ($("#search-filter").children().length == 1) {
            $("#search-filter").css({ display: "none" });
        }
        //删除标签获取服务列表
        SQuery.Get_QTableServiceList_ByP();
    },
    RemoveList: function (e) {
        $(this).parent().parent().children().remove();
    },
    //增加访问量
    Add_pageview: function (id) {
        var para = {
            "stype": "updateVisits",
            "id": id
        };
        var url = qurl + "?mn=updateVisits&id=" + id;
        ////  ie8 || ie9;
        //if(navigator.userAgent.indexOf("MSIE 8.0")>0 || navigator.userAgent.indexOf("MSIE 9.0")>0 ) {
        //    var xdr = new XDomainRequest(); // Use Microsoft XDR
        //    xdr.open('get',url);
        //    xdr.onload = function () {
        //        var dom = new ActiveXObject('Microsoft.XMLDOM'),
        //            JSON = $.parseJSON(xdr.responseText);
        //
        //        dom.async = false;
        //        if (JSON == null || typeof (JSON) == 'undefined') {
        //            JSON = $.parseJSON(data.firstChild.textContent);
        //        }
        //    };
        //    xdr.onerror = function () {
        //        _result = false;
        //    };
        //    xdr.send();
        //}else {
        $.ajax({
            type: "POST",
            async: false,
            data: para,
            url: qurl,
            success: function (json) {
                //txt=$.parseJSON(json);
            },
            error: function (e) {
                alert("访问量存储失败！");
            }
        });
        //}
    },

    //模块跳转-服务注册
    Service_submit: function () {
        if (UserEmail == "") {
            $('#myModal').modal({ backdrop: true, keyboard: true });
            $("#mymodal").modal("toggle");
        } else {
            window.open(SERVICE_URL + "submit.html", "_blank");
        }
    },
    //模块跳转-服务审核
    Service_exam: function () {
        window.open(SERVICE_URL + "exam.html", "_blank");
    },
    //模块跳转-个人中心
    Service_person: function () {
        window.open(SERVICE_URL + "person.html", "_blank");
    },
    //判断用户权限（服务资源）
    IsUserByEmail: function () {
        if (UserEmail != "") {
            $("#js-scroll-bar li").eq(0).css({ display: "block" });
            var para = {
                "stype": "isUserByEmail",
                "email": UserEmail
            };

            $.ajax({
                type: "POST",
                async: false,
                data: para,
                url: qurl,
                success: function (json) {
                    if (json == "true") {
                        $("#js-scroll-bar li").eq(2).css({ display: "block" });
                    }
                },
                error: function (e) {
                }
            });
        }
    }
};
var STool={
    //登录提示模态框关闭
    ModelClose:function(){
        $("#mymodal").modal("hide");//模态框关闭
        Usr.T_login();//跳转登录
    }
};


function bindFuwuInfoList(jsonResult, div, pageNum) {
    var jsonList = jsonResult.split('||');
    var json = "";
    var totalRecords = 0;
    if (jsonList[0] != "") json=$.parseJSON(jsonList[0]);
    var totalJson = "";
    if (jsonList[1] != "") {
        totalJson = $.parseJSON(jsonList[1]);
        totalRecords=totalJson[0].totalRecords;
    }
    var txt = "";
    $("#servicenum").text(totalRecords); //获取服务数量 
    if (json) {
        var list = json;
        if (list) {
            for (var i = 0; i < list.length; i++) {
                path = "/img/fuwu/fuw.jpg";
                txt += '<div class="pub_show" data-id="' + list[i].ID + '">';
                txt += '<div class="pub_tit">';
                txt += '<div class="pub_titleft">' + list[i].S_NAME + '</div>';
                txt += '<div class="pub_titrt"><a>详细信息>></a></div>';
                txt += '</div>';
                txt += '<div class="pub_con">';
                txt += '<div class="pub_img">';
                txt += '<img src="' + path + '" onerror="javascript:this.src=' + defaultpic + '" style="cursor:pointer;"/>';
                txt += '</div>';
                txt += '<div class="pub_pro">';
                txt += '<div class="pub_dw"><strong>提供单位：</strong><span>' + list[i].S_JG + '</span></div>';
                txt += '<div class="pub_dw"><strong>注册时间：</strong><span>' + list[i].S_ZCSJ + '</span></div>';
                txt += '<div class="pub_dw"><strong>摘要信息：</strong><span>' + list[i].S_JJ + '</span></div>';
                txt += '<div class="pub_dw">';
                txt += '<strong class="gjztit">关键字：</strong>';
                txt += '<div class="gjz">';
                if (list[i].S_GJC != "") {
                    var strings = (list[i].S_GJC).replace(/\，/g, ",");
                    var keys = strings.split(",");
                    for (var j = 0; j < keys.length; j++) {
                        txt += '<span>' + keys[j] + '</span>';
                    }
                }
                txt += '</div>';
                txt += '</div>';
                txt += '</div>';
                txt += '</div>';
                txt += '</div>';
            }
            
        }
    }
    else {
        txt += '<form class="bs-docs-example">';
        txt += '<fieldset class="adminform">';
        txt += '<div class="ServiceList" style="margin: 5px 0px -5px 5px;">不好意思，找不到符合搜索条件的服务内容。</div>';
        txt += '</fieldset>';
        txt += '</form>';
        $("#pagination").empty();
    }
    div.html(txt);
    //添加分页工具
    if (parseInt(pageNum) == 1) {
        SQuery.Add_pagination(totalRecords);
    }
    //详细信息
    $(".pub_titrt").bind('click', function () {
        var sid = $(this).parent().parent().attr('data-id');
        window.open("/src/servicepublic/showservice.html?sid=" + sid + "&action=view", "_blank");
        //SQuery.Add_pageview(sid);
    });
    //点击图片进行服务预览
    $(".pub_img").bind('click', function () {
        var sid = $(this).parent().parent().attr('data-id');
        window.open("/src/servicepublic/PreviewMap.html?id=" + sid + "&action=view", "_blank");
        //SQuery.Add_pageview(sid);
    });
    
}